home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / QuickDraw GX / QuickDraw GX Info / QuickDraw GX Interfaces / Interfaces & Libraries / interfaces / shape controls library.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-30  |  4.3 KB  |  86 lines  |  [TEXT/MPS ]

  1. /* gxShape controls library:
  2.     library to allow the user to manipulate (gxTransform) a set of shapes
  3.     by Dave Good and Jeff Kreegar
  4.     Copyright 1991 - 1993 Apple Computer, Inc.  All rights reserved.    */
  5.  
  6. #pragma once
  7. #ifndef shapeControlsLibraryIncludes
  8.     #define shapeControlsLibraryIncludes
  9.  
  10.     #ifndef __EVENTS__
  11.     #include <Events.h>
  12.     #endif
  13.     
  14.     #ifndef graphicsTypesIncludes
  15.     #include "graphics types.h"
  16.     #endif
  17.     
  18.     #ifdef __cplusplus
  19.     extern "C" {
  20.     #endif
  21. /*
  22. |   General Information:
  23. |
  24. |   • The items gxShape passed in is used directly by the gxShape controls library; the application may modify or
  25. |      look at it at any time. Note that if the application removes or adds a sub-gxShape (or changes a sub-gxShape
  26. |      in any way) then it needs to call InvalidShapeControlShape on the sub-gxShape.
  27. |
  28. |   • The foreground and background shapes are also used directly by the gxShape controls library and therefore
  29. |      can be modified at any time (and also must be invalidated). The background gxShape appears underneath all
  30. |      the items and the foreground gxShape appears above all the items, but below the control handles for the
  31. |      current selection.
  32. |
  33. |   • The foreground and background shapes will both be modified slightly to draw to the same list of viewPorts
  34. |      that the items picture goes to. Other than this, they will not be changed.
  35. |
  36. |   • GetShapeControlSelection and SetShapeControlSelection do NOT work directly with the selection picture
  37. |      inside the gxShape control; instead GetShapeControlSelection returns a completely new picture that contains
  38. |      all the sub-shapes of the item picture that are selected. The application must then dispose of this returned
  39. |      picture when it is through with it. SetShapeControlSelection will select all the sub-shapes of the items
  40. |      picture contained by shapesToSelect. The application may then dispose of this shapesToSelect picture. The
  41. |      shapesToSelect parameter may be a single sub-gxShape instead of a picture, but it must always be contained
  42. |      by the items picture.
  43. |
  44. |   • GetShapeControlSelectionHandles returns a copy of the gxShape that is drawn as the selection’s handles.
  45. |
  46. |   • SendEventToShapeControl returns true if it handled the event and false if it didn’t. The events handled are:
  47. |       * keyDown: delete removes the item
  48. |       * mouseDown: in a destination gxViewPort for the items picture, the selection will be tracked; any other
  49. |          mouse event will return false.
  50. |
  51. |   • InvalidateShapeControlShape does NOT require that invalidShape be a member of the items picture for the
  52. |      gxShape control. However, if invalidShape is a member and it is selected, then the control handles will be
  53. |      added to the invalid area also. An application should use this call when invalidating a picture containly
  54. |      several widely separated disjoint areas; it should probably use InvalidateShapeControlRectangle to invalidate
  55. |      other types of shapes.
  56. |
  57. |   • UpdateShapeControl redraws all the invalid areas that have been recorded by calls to InvalidateShapeControlShape
  58. |      and InvalidateShapeControlRectangle.
  59. |
  60. |   • The gxShape controls library will try to allocate an offscreen buffer for each of the viewPorts that the items
  61. |      picture draws into. If this buffer is allocated, then the manipulation of the sub-objects will be flicker-free.
  62. |      If, on the other hand, there is not enough memory to allocate this buffer, then the gxShape controls library
  63. |      will still work, but the objects will flicker quite a bit as they are manipulated.
  64. */
  65.  
  66.     typedef struct shapeControlRecord **shapeControl;
  67.  
  68.     shapeControl NewShapeControl(gxShape items, gxShape background, gxShape foreground);
  69.     void DisposeShapeControl(shapeControl target);
  70.  
  71.     gxShape GetShapeControlSelection(const shapeControl source);
  72.     void SetShapeControlsSelection(shapeControl target, gxShape shapesToSelect, boolean bringToFront, boolean replaceSelection);
  73.     gxShape GetShapeControlSelectionHandles(const shapeControl source);
  74.  
  75.     boolean SendEventToShapeControl(shapeControl target, EventRecord *event);
  76.  
  77.     void InvalidateShapeControlShape(shapeControl target, gxShape invalidShape);
  78.     void InvalidateShapeControlRectangle(shapeControl target, gxRectangle *bounds);
  79.  
  80.     void UpdateShapeControl(shapeControl target);
  81.  
  82.     #ifdef __cplusplus
  83.     }
  84.     #endif
  85. #endif  /* shapeControlsLibraryIncludes */
  86.